package nongchang.kuaijiecaifu.com.ncapp_android.ui.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import ezy.lite.util.DateTime;
import nongchang.kuaijiecaifu.com.ncapp_android.R;
import nongchang.kuaijiecaifu.com.ncapp_android.common.adapter.ItemAdapter;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.good.Address;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.good.IntegralDetail;

/**
 * Created by Administrator on 2016/4/26 0026.
 */
public class IntegralDetailListAdapter extends ItemAdapter<IntegralDetail, IntegralDetailListAdapter.IntegralDetailViewHolder> {
    private Context context;

    public IntegralDetailListAdapter(Context context) {
        super(context);
        this.context = context;
    }

    @Override
    public IntegralDetailViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new IntegralDetailViewHolder(inflate(R.layout.item_integral_detail, parent));
    }

    @Override
    public void onBindViewHolder(IntegralDetailViewHolder holder, int position) {
        IntegralDetail item = getItem(position);
        holder.txt_time.setText(DateTime.toDate(item.time*1000));
        holder.txtTitle.setText(item.title);
        holder.txt_integral.setText(item.integral);
    }


    static class IntegralDetailViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.txt_title)
        TextView txtTitle;
        @BindView(R.id.txt_time)
        TextView txt_time;
        @BindView(R.id.txt_integral)
        TextView txt_integral;

        public IntegralDetailViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
            itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
//                    ContextUtil.startActivity(v.getContext(), LifeShopActivity.class);
                }
            });
        }

    }
}
